package crp.core.workflow.app.loaders;

import com.qwlabs.security.Caller;
import crp.core.security.Callers;
import crp.core.workflow.domain.models.WorkflowCandidate;
import crp.core.workflow.domain.models.WorkflowCandidateType;
import crp.core.workflow.domain.services.WorkflowCandidateLoader;

import javax.enterprise.context.ApplicationScoped;
import javax.validation.constraints.NotNull;
import java.util.Set;

@ApplicationScoped
public class WorkflowCandidateUserLoader implements WorkflowCandidateLoader {
    @Override
    public Set<WorkflowCandidate> load(@NotNull Caller caller) {
        return Set.of(WorkflowCandidate.builder()
                .type(WorkflowCandidateType.USER)
                .target(Callers.userId(caller))
                .build());
    }
}
